package com.hs.mobile.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import java.util.List;

import org.apache.log4j.Logger;
import com.hs.mobile.model.Notifications;
import com.hs.mobile.service.notifications.NotificationsService;

@Controller
public class NotificationsController {
	protected static Logger logger = Logger.getLogger(NotificationsController.class);
	@Resource(name="notificationsService")
	private NotificationsService notificationsService;
	
	@Autowired
	public NotificationsController( NotificationsService notificationsService )
	{
		this.notificationsService = notificationsService;
	}
	
	@GET
	@RequestMapping(value="/notification/{id}", method = RequestMethod.GET )
	@Produces(MediaType.APPLICATION_JSON)
	public @ResponseBody Notifications getNotifications(@PathVariable("id") Long id )
	{
		return notificationsService.findNotificationsById(id);
	}
	
	@GET
	@RequestMapping(value="/notifications", method = RequestMethod.GET )
	@Produces(MediaType.APPLICATION_JSON)
	public @ResponseBody List<Notifications> getListNotifications()
	{
		return notificationsService.getAllNotifications();
	}
}
